<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>智能E生</title>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta name="format-detection" content="telephone=yes">
<meta http-equiv="x-rim-auto-match" content="none">

<link rel="stylesheet" href="./css/weui.css" />
<link rel="stylesheet" href="./css/example.css" />

<script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=A0YwaB4T30OXQu1KN3RVGiQgnakCvymn"></script>
<script type="text/javascript" src="js/common.js"></script>
<!-- <script type="text/javascript" src="js/index.js"></script> -->

<style type="text/css">
ul li {
	padding-left: 0px;
	font-size: 13px;
	padding-top: 5px;
	list-style: none;
	border-bottom: 1px solid #ECEBEE;
}

ul li a div p {
	color: #000;
}

ul li a div p div {
	color: #000;
}
.icon_1{
	width: 45px;
    height: 45px;
}
</style>
</head>
<script type="text/javascript">
var lng=$("#lng").val();
var lat=$("#lat").val();
var userName = window.localStorage.getItem("primaryRole");

$(function() {
	if(lng==""||lat==""){
		toMap();
	}
		//设置默认时间为1900-01-01
	var defaultTime = new Date();
	defaultTime.setFullYear(1900,0,1);
	defaultTime.setHours(0);
	defaultTime.setMinutes(0);
	defaultTime.setSeconds(0);
	
	var todayStart = new Date();
	var todayEnd = new Date();
	todayStart.setHours(0);
	todayStart.setMinutes(0);
	todayStart.setSeconds(0);
	todayEnd.setHours(23);
	todayEnd.setMinutes(59);
	todayEnd.setSeconds(59);
	$.ajax({
		url : "./linkAricle/toLinkAricleList.spring",
		type : "POST",
		data : {
			limit : 10,
			offset :　0,
			startTime : defaultTime,
			endTime : todayEnd
		},
		dataType : 'json',
		success : function(ret) {
			if (ret.rows != null) {
				var html="";
				$("#zixun").html("");
				for (var i = 0; i < ret.rows.length; i++) {
					html += "<li ><a class=\"weui_cell\" href=\""+ret.rows[i].linkAricle+"\" style=\"padding: 0px 5px;\">";
					html += "<div class=\"weui_cell_bd weui_cell_primary\">";
					if(ret.rows[i].title.length>10){
						html += "<p style=\"color: blue;font-size: 13px;\">" + ret.rows[i].title.substring(0,10) + "...</p>";
					}else{
						html += "<p style=\"color: blue;font-size: 13px;\">" + ret.rows[i].title + "</p>";
					}
					html += "</div>";
					html += "<div class=\"weui_cell_ft\"  style=\"font-size: 13px;\">"
							+ getSmpFormatDateByLong(ret.rows[i].startTime,false) + "</div></a></li>";
				}
				$("#zixun").append(html);
			} else {

			}
		}
	});
});
//诊断自测
/*function toSelfTest(){
	if(userName && userName!=null && userName!=''){
		 url="./jsp/conditionsList.jsp";
		 window.location.href=url;
	}else{
		alert("请先登录");
		 url="./jsp/login.jsp";
		 window.location.href=url;
	}
}*/
function toSelfTest(){
	if(userName && userName!=null && userName!=''){
		//url="./jsp/asking_ds.jsp";
		url="./jsp/asking_ai.jsp?v="+Math.random();
		window.location.href=url;
	}else{
		alert("请先登录");
		url="./jsp/login.jsp";
		window.location.href=url;
	}
}

//个人病历
function toMyCaseHistory(){
	if(userName && userName!=null && userName!=''){
		 url="./jsp/caseHistory/medicalrecordList.jsp";
		 window.location.href=url;
	}else{
		alert("请先登录");
		 url="./jsp/login.jsp";
		 window.location.href=url;
	}
}

//电子病历
function toCaseHistory(){
return;
	if(userName && userName!=null && userName!=''){
		 url="./jsp/caseHistory/caseHistoryList.jsp";
		 window.location.href=url;
	}else{
		alert("请先登录");
		 url="./jsp/login.jsp";
		 window.location.href=url;
	}
}
//个人中心
/* function toCenter(){
	var url="./personalCenter/personCenterList.jsp";
	window.location.href=url;
} */

//附近医疗
function findHospital(){
	var lng=$("#lng").val();
	var lat=$("#lat").val();
	var url="./jsp/findHospital.jsp?lng="+lng+"&lat="+lat;
	window.location.href=url;
	 
}

function moreAricle(){
	var url="./jsp/aricleList.jsp";
	window.location.href=url;
}

function toSmart(){
	var url="./jsp/smartCabinet.jsp";
	window.location.href=url;
}
function getIness(){
	return ;
	var url="./jsp/inessList.jsp";
	window.location.href=url;
}

// 百度地图API功能
function toMap() {
	var map = new BMap.Map("allmap");
	var point = new BMap.Point(116.331398, 39.897445);
	map.centerAndZoom(point, 16);

	var geolocation = new BMap.Geolocation();
	geolocation.getCurrentPosition(function(r) {
		if (this.getStatus() == BMAP_STATUS_SUCCESS) {
			var mk = new BMap.Marker(r.point);
			map.addOverlay(mk);
			map.panTo(r.point);
			lng = r.point.lng;
			lat = r.point.lat;
			$("#lng").val(lng);
			$("#lat").val(lat);
		} else {
			alert('failed' + this.getStatus());
		}
	}, {
		enableHighAccuracy : true
	});
}
</script>
<body ontouchstart>
	<div class="container js_container"></div>
	<div class="page">
		<div class="hd" style="padding: 0em 0;">
			<div>
				<img alt="" src="./images/logo3.jpg" width="100%">
			</div>
		</div>
		<div class="bd">
			<div class="weui_grids">
				<a href="javascript:;" class="weui_grid js_grid" data-id="msg" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/6.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;" onclick="toSmart();">智能药箱</p>
				</a> 
			
				<a href="./jsp/personalCenter/personCenterList.jsp" class="weui_grid js_grid" data-id="icons" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;">
					<div class="weui_grid_icon icon_1">
						<img src="images/7.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">个人中心</p>
				</a> 

				<a href="javascript:;" class="weui_grid js_grid" data-id="toast" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/5.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;" onclick="getIness();">外诊解读</p>
				</a> 

				<a href="javascript:;" class="weui_grid js_grid" data-id="button" onclick="" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/4.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">结果解读</p>
				</a> 
				
				<a href="javascript:;" class="weui_grid js_grid" data-id="button" onclick="toSelfTest();">
					<div class="weui_grid_icon icon_1">
						<img src="images/1.png" alt="">
					</div>
					<p class="weui_grid_label">
						<span style="font-style: normal;color: blue;"><b>疾病自诊</b></span>
					</p>
				</a> 

				<a href="javascript:;" class="weui_grid js_grid" data-id="button" onclick="toCaseHistory();" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/8.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">名医问诊</p>
				</a> 
				
				<a href="tel:15899882002" class="weui_grid js_grid" data-id="button" onclick="" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/2.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">一键呼叫</p>
				</a> 				
				
				<a href="javascript:;" class="weui_grid js_grid" data-id="button" onclick="toMyCaseHistory();" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;">
					<div class="weui_grid_icon icon_1">
						<img src="images/3.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">病历管理</p>
				</a>
				
				<a href="javascript:;" class="weui_grid js_grid" data-id="dialog" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;display: none">
					<div class="weui_grid_icon icon_1">
						<img src="images/9.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">健康管理</p>
				</a> 
				
<!-- 				<a href="javascript:;" class="weui_grid js_grid" data-id="button" onclick="findHospital();" style="background-color: rgba(86, 72, 101, 0.18);border-radius: 7px;">
					<div class="weui_grid_icon">
						<img src="images/categorys.png" alt="">
					</div>
					<p class="weui_grid_label" style="color: blue;">附近医疗</p>
				</a> -->
			</div>
		</div>
		<div style="margin-top: 5px;">
			<span style="font-size: 15px;padding-left: 0.66666%;">医疗公众号</span>
			<span style="font-size: 12px;padding-left: 16px;" onclick="moreAricle();">更多>></span>
			<hr style="color: black;opacity: 0.2;">
			<ul style="line-height: 2.0;overflow: scroll;" id="zixun" ></ul>
		</div>
		<div id="allmap"></div>
	</div>
	<input type="hidden" id="lng" value="" />
	<input type="hidden" id="lat" value="" />
</body>
</html>
